package org.lc.service.system.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.lc.platform.base.result.Result;
import org.lc.platform.mybatis.crud.controller.CrudBaseController;
import org.lc.service.system.dto.SysRoleDto;
import org.lc.service.system.entity.SysRole;
import org.lc.service.system.service.SysRoleService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.lc.platform.base.vo.SelectListVo;
import java.util.List;

@RestController
@RequestMapping("/role")
@Validated
@Tag(name = "角色模块")
    public class SysRoleController extends CrudBaseController<SysRole, SysRole, SysRoleDto, SysRoleService> {
    public SysRoleController(SysRoleService service) {
        super(service);
    }


    @Operation(summary = "角色是否存在")
    @GetMapping("/exits/{role}")
    private Result<Boolean> getRoleExits(@PathVariable("role") String role) {
        return Result.data(this.getService().getRoleExits(role));
    }

    @Operation(summary = "角色SELECT列表")
    @GetMapping("/select/list")
    private Result<List<SelectListVo>> getRoleSelectList() {
        return Result.data(this.getService().getRoleSelectList());
    }
}
